﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 个人小工具
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public Regex regex;

        private void button1_Click(object sender, EventArgs e)
        {
            regex = new Regex(textBox1.Text);
            List<string> src = richTextBox1.Text.Split('\n').ToList();
            src.RemoveAll(x=>x=="");
            List<string> result = new List<string>();
            foreach(string s in src)
            {
                string temp = regex.Replace(s, textBox2.Text);
                Console.WriteLine(temp);
                result.Add(temp);

            }
            richTextBox2.Clear();
            richTextBox2.Text = string.Join("\n", result);
            
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //Shell.AllocConsole();
        }
    }
}
